/*
 * @Author: your name
 * @Date: 2021-04-16 22:11:16
 * @LastEditTime: 2021-04-16 23:03:53
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \control_flow\src\main.rs
 */

fn convert_temp(fahrenheit:f32)->f32{
    println!("输入的华氏度是 {}", fahrenheit);
    let degree = 32.0 + fahrenheit*1.8;
    degree
}
fn my_fun(a:u32, b:i16, c:char)-> bool{
    println!("my_fun a={}, b={}, c={}",a,b,c);
    true
}

fn main() {
    let mut counter = 0;
    let result = loop{
        counter += 1;
        if counter > 10 {
            break counter*2;
        }
    };
    println!("the result is {}", result);
    let mut b = 10;
    while b > 0 {
        println!("in while b :{}", b);
        b -= 1;
    }
    let a = [0,1,2,3,4,5];
    for element in a.iter() {
        println!("the value is :{}", element);
    }
    for number in (1..4).rev(){
        println!("{}!", number);
    }
    println!("LIFTOFF");

    let return_value = my_fun(10, -10, 'a');
    println!("return_value is {}", return_value);

    println!("得到的摄氏度 degree is {}", convert_temp(30.4));

    //let my_string = "yes";
    let mut my_string = String::from("hello");
    my_string.push_str(" is me");
    println!("my_string is {}", my_string);
    println!("Hello, world!");
}
